package com.example.springboot.mapper;
import com.example.springboot.controller.request.BorrowPageRequest;
import com.example.springboot.entity.Borrow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BorrowMapper {
    List<Borrow> listByCondition(BorrowPageRequest borrowPageRequest);
    int count(@Param("search") String search);
    void updateStatus(@Param("recordId") int recordId, @Param("status") int status);

    void addBorrow(Borrow borrow);

    @Select("SELECT COUNT(*) FROM borrow WHERE DATE(borrowDate) = CURDATE()")
    int countTodayBorrows();
}